package com.chrissy.music.controller;

import com.chrissy.music.common.result.Result;
import com.chrissy.music.system.service.SysFileService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author Johnson
 */
@RestController
@RequiredArgsConstructor
@Tag(name = "文件管理", description = "文件管理")
public class SysFileController {

    private final SysFileService sysFileService;

    @Operation(summary = "上传文件")
    @PostMapping("/upload")
    public Result<String> upload(@Parameter(name = "file",description = "文件")
                                 @RequestParam("file") MultipartFile file) {
        return Result.success(sysFileService.upload(file));
    }

}
